package api_.map_;

import java.util.*;

public class HashMapDemo
{
    public static void main(String[] args)
    {
        HashMap<String,Integer> hashMap = new HashMap<>();
        hashMap.put("a",1);
        hashMap.put("b",2);
        hashMap.put("c",3);
        hashMap.put("d",0);
        // 获取values集合
        Collection<Integer> values = hashMap.values();
        // 获取keys集合
        Set<String> strings = hashMap.keySet();


        Iterator<Integer> iterator = values.iterator();
        int sum = 0;
        while (iterator.hasNext())
        {
            Integer tmep = iterator.next();
            sum += tmep;
        }

        for (String s : strings)
        {
            if (hashMap.get(s) > 0)
            {
                System.out.println(s);
            }
        }


    }
}
